/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.itriage.hospital.app.factory;

import com.itriage.hospital.model.*;
import java.sql.Time;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 *
 * @author Leo
 */
public class Appfactory {

    
    public static Hospital creatHospital(Map<String, String> values) {
        Hospital hospital = new Hospital();
        hospital.setName(values.get("name"));
        hospital.setCode(values.get("code"));

        Department department = new Department();
        department.setDeptName(values.get("dept1"));
        department.setDeptCode(values.get("dept11"));

        Department department2 = new Department();
        department2.setDeptName(values.get("dept2"));
        department2.setDeptCode(values.get("dept22"));

        Department department3 = new Department();
        department3.setDeptName(values.get("dept3"));
        department3.setDeptCode(values.get("dept33"));

        Ward females = new Ward();
        females.setWardcode(values.get("code1"));
        females.setWardStatus(values.get("status1"));
        females.setGender(values.get("gender1"));

        Ward males = new Ward();
        males.setWardcode(values.get("code2"));
        males.setWardStatus(values.get("status2"));
        males.setGender(values.get("gender2"));


        Ward males1 = new Ward();
        males1.setWardcode(values.get("code2"));
        males1.setWardStatus(values.get("status2"));
        males1.setGender(values.get("gender2"));


        Ward females1 = new Ward();
        females1.setWardcode(values.get("code1"));
        females1.setWardStatus(values.get("status1"));
        females1.setGender(values.get("gender1"));


        Ward males3 = new Ward();
        males3.setWardcode(values.get("code2"));
        males3.setWardStatus(values.get("status2"));
        males3.setGender(values.get("gender2"));


        Ward females3 = new Ward();
        females3.setWardcode(values.get("code1"));
        females3.setWardStatus(values.get("status1"));
        females3.setGender(values.get("gender1"));

        department.getWards().add(males);
        department.getWards().add(females);

        department2.getWards().add(males1);
        department2.getWards().add(females1);

        department3.getWards().add(males3);
        department3.getWards().add(females3);

        hospital.getDepartment().add(department);
        hospital.getDepartment().add(department2);
        hospital.getDepartment().add(department3);
        return hospital;
    }

   
   public static Available_staff creatAvailable_staff(Map<String, String> values) {
       Available_staff available_staff = new Available_staff();
       available_staff.setDay(values.get("day"));
       available_staff.setTime(values.get("time"));
       available_staff.setName(values.get("name"));
      // available_staff.setAppointment(null);
       
       return available_staff;
   }
    public static Department creatDepartment(Map<String, String> values) {
        Department department = new Department();
        department.setDeptName(values.get("deptName"));
        department.setDeptCode(values.get("DeptCode"));
        department.setAppointment(null);
        department.setStaff(null);
        department.setWards(null);
        return department;
        
    }
     public static Patient creatPatient(Map<String, String> values,Appointment appointment) {
         Patient patient =new Patient();
         patient.setAppointment(appointment);
         patient.setContactNo(values.get("ContactNo"));
         patient.setDateOfBirth(values.get("DateOfBirth"));
         patient.setEmail(values.get("Email"));
         patient.setFirstName(values.get("FirstName"));
         patient.setGender(values.get("Gender"));
         patient.setHomeAddress(values.get("HomeAddress"));
         patient.setIDNumber(values.get("IDNumber"));
         patient.setLasName(values.get("LasName"));
         patient.setPostalAddress(values.get("PostalAddress"));
         patient.setRace(values.get("Race"));
         patient.setTitle(values.get("Title"));
         
         return patient;
     }
      public static Patient_record creatPatient_record(Map<String, String> values) {
          Patient_record patient_record = new Patient_record();
          patient_record.setIDNumber(values.get("IDNumber"));
          patient_record.setPrescription(values.get("Prescription"));
          patient_record.setDescription(values.get("Description"));
          patient_record.setAllergies(values.get("Allergies"));
          
          return patient_record;
      }
      public static Appointment creatAppointment(Map<String, String> values,List<Available_staff> available_staff,
        Patient patients ,List<Patient_record> patient_records) {
        Appointment appointment = new Appointment();
        appointment.setTime(values.get("time"));
        appointment.setDate(values.get("date"));
        appointment.setAvailable_staff(available_staff);
        appointment.setPatient(patients);
        appointment.setPatient_record(patient_records);
        
        return appointment;
   }
      public static Staff creatStaff(Map<String, String> staffs ,Staff_infor staff_infors,List<Available_staff> available_staffs) {
          Staff staff = new Staff();
          staff.setAvailable_staff(available_staffs);
          staff.setEducation(staffs.get("Education"));
          staff.setStaffNum(staffs.get("StaffNum"));
          staff.setStaff_infor(staff_infors);
          return staff;
          
      }
       public static Staff_infor creatStaff_infor(Map<String, String> infor) {
           Staff_infor staff_infor = new Staff_infor();
           staff_infor.setContactNo(infor.get("ContactNo"));
           staff_infor.setDateOfBirth(infor.get("DateOfBirth"));
           staff_infor.setEmail(infor.get("Email"));
           staff_infor.setFirstName(infor.get("FirstName"));
           staff_infor.setGender(infor.get("Gender"));
           staff_infor.setHomeAddress(infor.get("HomeAddress"));
           staff_infor.setIDNumber(infor.get("IDNumber"));
           staff_infor.setLasName(infor.get("LasName"));
           staff_infor.setPostalAddress(infor.get("PostalAddress"));
           staff_infor.setRace(infor.get("Race"));
           staff_infor.setTitle(infor.get("Title"));
           
           return staff_infor;
       }
       public static Ward creatWard(Map<String, String> wards) {
           Ward ward = new Ward();
           ward.setWardcode(wards.get("Wardcode"));
           ward.setGender(wards.get("Gender"));
           ward.setWardStatus(wards.get("WardStatus"));
           
          return ward;
       }
      
    
}
